package com.gxa.ehome.controller;


import com.gxa.ehome.service2.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;

@Component("sysUserController")
public class SysUserController {
    //自动装配 通过当前目标bean的类型 作为参考,到spring的容器中
    //去寻找匹配类型的bean 如果找到就将目标bean注入到成员身上.
    //匹配的规则:byType:根据对象bean的类型匹配.
    //如果要按name/id匹配的话 需要用到@Qualifier()
   @Autowired()
   @Qualifier("sysUserService2")
    private SysUserService sysUserService;


//    public SysUserController(SysUserService sysUserServic) {
//        this.sysUserService=sysUserServic;
//    }

    public void login(){
        System.out.println("1.SysUserController的方法");
        sysUserService.selectByQuery();
    }
}
